package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    
    @Select("select id, openid, name, phone, sex, id_number, avatar, create_time from user where openid=#{openid}")
    User selectByOpenId(String openid);

    @Insert("insert into user (openid) values(#{openid});")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    void add(User user);
}
